<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var obj = {
      name: "why",
      age: 18
    }
    Object.defineProperty(obj, "name", {
      configurable: false, // name属性不可以删除
      enumerable: false,// Object.keys或for-in的时候不返回该属性
      writable: false, // 不可写
      value: "coderwhy", // 修改值
    })
    // configurable: false, // name属性不可以删除
    delete obj.name
    console.log(obj)
 
    Object.defineProperty(obj, "address", {})
    delete obj.address
    console.log(obj)
    // enumerable: false,// Object.keys或for-in的时候不返回该属性
    console.log(Object.keys(obj))

    // writable: false, // 不可写
    obj.name = 'kobe'
    console.log(obj)

    // value: "coderwhy" // 修改值
    console.log(obj)

  </script>
</body>

</html>